package cn.edu.cdut.utils;

import cn.edu.cdut.enums.MyResEnum;
import cn.edu.cdut.dto.MyRes;

/**
 * Author  kobe
 * Created on 2017-05-26-15:39
 */
public class MyResUtil {
        public static MyRes success(Object object) {
                MyRes myRes = new MyRes();
                myRes.setCode(MyResEnum.SUCCESS.getCode());
                myRes.setMsg(MyResEnum.SUCCESS.getMsg());
                myRes.setData(object);
                return myRes;
        }

        public static MyRes success() {
                return success(null);
        }

        public static MyRes error(Integer code, String msg) {
                MyRes myRes = new MyRes();
                myRes.setCode(code);
                myRes.setMsg(msg);
                return myRes;
        }
}
